/**
* \brief 
* \author pengcheng (pengcheng@yslrpch@126.com)
* \date 2020-05-23
* \attention CopyrightÃ‚Â©ADC Technology(tianjin)Co.Ltd
* \attention Refer to COPYRIGHT.txt for complete terms of copyright notice
*/
#ifndef CMW_APP_TIME_ADCSOFT_H
#define  CMW_APP_TIME_ADCSOFT_H

#include <cmw_app/time_adcsoft.h>
#include <iostream>

namespace adc
{

class Worker
{

public:
    enum
    {
        WS_INIT         = 0x001,
        WS_RUN          = 0x002,
        WS_SUSPEND      = 0x003,
        WS_TERMINATE    = 0x004, 
    };

public:
    Worker(float hz=20);

    virtual ~Worker();

    virtual void DoWork() = 0;

    void Run();

    void Suspend();

    void Terminate();

protected:
    void MainThread();

protected:
    std::thread main_thread_;
    Timer timer_;
    std::uint16_t worker_state_;
};

}

#endif
